{% extends request.ajax ? "layout_blank.phtml" : "layout_default.phtml" %}

{% block meta_title %}{% trans 'Blog'%}{% endblock %}

{% block content %}
<div class="h-block">
    <div class="h-block-header">
        <div class="icon"><span class="big-light-icon i-blog"></span></div>
        <h2>{% trans 'News & Announcements' %}</h2>
        <p>{% trans 'Track our latest posts' %}</p>
    </div>
    <div class="block articles">
    {% set posts = guest.news_get_list({"page":request.page,"per_page": 5}) %}
    {% for i, post in posts.list %}
        <div class="article{% if loop.last %} last{% endif%}">
            <h2><a href="{{ '/news'|link }}/{{post.slug}}">{{post.title}}</a></h2>
            {% if post.excerpt %}
                {{post.excerpt|bbmd}}
            {% else %}
                {{ post.content|bbmd }}
            {% endif %}
            <p class="meta">{{post.updated_at|bb_date}}</p>
            <a class="bb-button read_more" href="{{ '/news'|link }}/{{post.slug}}">{% trans 'Read more..' %}</a>
        </div>
    {% else %}
    <p>The list is empty</p>
    {% endfor %}
    </div>
    <div class="clear"></div>
</div>

{% include "partial_pagination.phtml" with {'list': posts} %}

{% endblock %}